package com.production.CoursePlatform.service;

import com.production.CoursePlatform.entity.Schedule;
import com.production.CoursePlatform.mapper.ScheduleMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import java.util.List;

@Service
public class ScheduleService {

    @Autowired
    private ScheduleMapper scheduleMapper;

    // 根据 sID 查找 Schedule
    public Schedule findScheduleBySID(int sID) {
        return scheduleMapper.findBySID(sID);
    }

    // 添加 Schedule，不设置 scID
    public int addSchedule(Schedule schedule) {
        return scheduleMapper.insertWithoutScID(schedule);
    }

    // 根据 scID 更新 Schedule
    public int updateSchedule(Schedule schedule) {
        return scheduleMapper.updateSchedule(schedule);
    }

    // 根据 scID 删除 Schedule
    public int deleteSchedule(int scID) {
        return scheduleMapper.deleteByScID(scID);
    }

    // 查询所有 Schedule
    public List<Schedule> findAllSchedules() {
        return scheduleMapper.selectList(null);
    }
}



